package com.wenx.utils;

import java.time.Duration;
import java.time.LocalDateTime;

/**
 * Created by wenx on 2019-07-29 10:34
 */
public class MyDateUtils {

    public static void getDateTimeBetween(LocalDateTime end, LocalDateTime start) {
        Duration duration = Duration.between(end,start);
        long days = duration.toDays(); //相差的天数
        long hours = duration.toHours();//相差的小时数
        long minutes = duration.toMinutes();//相差的分钟数
        long millis = duration.toMillis();//相差毫秒数
        long nanos = duration.toNanos();//相差的纳秒数

        System.out.println("耗时【 "+days+"天："+hours+" 小时："+minutes+" 分钟："+millis+" 毫秒："+nanos+" 纳秒】");
    }

}
